package com.newlink.building.login.mvp.contract

import android.content.Context
import com.newlink.building.common_base.base.IModel
import com.newlink.building.common_base.base.IPresenter
import com.newlink.building.common_base.base.IView
import com.newlink.building.common_base.model.bean.AppConfigData
import com.newlink.building.common_base.model.bean.FcmsInfoData
import com.newlink.building.common_base.model.bean.HttpResult
import com.newlink.building.common_base.model.bean.KcpInfoData
import com.newlink.building.common_base.model.bean.KitDeviceData
import com.newlink.building.common_base.model.bean.LoginMsgCodeBean
import com.newlink.building.common_base.model.bean.LoginRequestBean
import com.newlink.building.common_base.model.bean.LoginResponseData
import com.newlink.building.common_base.model.bean.LoginSipAccountRequestBean
import com.newlink.building.common_base.model.bean.PolicyAgreementData
import com.newlink.building.common_base.model.bean.ResponseTopData
import com.newlink.building.common_base.model.bean.SipInfo
import com.newlink.building.common_base.model.bean.SipRequest
import com.newlink.building.common_base.model.bean.UserInfoData
import io.reactivex.Observable

/**
 * Created by xiaodong on 2022/8/24.
 */
interface Module_Login_LoginContract {

    interface View : IView {
        //        fun loginSuccess(data: UserInfoData)
        fun onGetUserInfoSuccess(data: UserInfoData)
        fun onGetUserInfoFailed()
        fun onGetKcpInfoSuccess(data: KcpInfoData)
        fun onGetAppConfigSuccess(data: AppConfigData)
        fun onKcpConnectSuccess()
        fun onKcpConnectFailed(status: Int)
        fun onKcpConnectLoopFailed()
        fun onGetTokenSuccess(token: String, userId: Long)
        fun onLoginFail(msg: String?)
        fun onKcpFail()
        fun onAppConfigFail()
        fun onRequestSipSuccess(data: SipInfo)
        fun onGetVerifyCodeSuccess()
        fun onGetVerifyCodeFailed(msg: String?)
        fun onFcmsSuccess(data: MutableList<FcmsInfoData>)
        fun onFcmsFail()
        fun onFcmsLoadLocalFirst()
        fun onGetAgreementSuccess(data: PolicyAgreementData?)
    }

    interface Presenter : IPresenter<View> {
        fun login(user: String, password: String)
        fun loginBySipAccount(sip: String, password: String)
        fun loginWithQR(userName: String, password: String)
        fun loginFls(user: String, password: String, userCategory: Int, needEncrypt: Boolean)
        fun loginFlsMsgCode(area: String, mobileNumber: String, code: String, userCategory: Int)
        fun getUserInformation(token: String, bean: Long)
        fun startBrowser(context: Context, url: String)
        fun showUserLicense(context: Context, type: Int)
        fun getKcpInformation(token: String, userId: Long)
        fun getAppConfig(token: String)
        fun getUserNameFromQrcode(qrcode: String): List<String>
        fun getKitDeviceDataFromQrcode(qrcode: String): ArrayList<KitDeviceData>
        fun requestSipRegister(data: SipRequest)
        fun getVerifyCode(area: String, phoneNumber: String, userCategory: Int)
        fun getFcmsInfoList(region: String, language: String)
        fun getAgreement()
    }

    interface Model : IModel {

        fun login(bean: LoginRequestBean): Observable<HttpResult<LoginResponseData>>
        fun loginWithQR(
            userName: String,
            password: String
        ): Observable<HttpResult<LoginResponseData>>

        fun loginWithSipAccount(bean: LoginSipAccountRequestBean): Observable<HttpResult<LoginResponseData>>
        fun getUserInformation(token: String, userId: Long): Observable<HttpResult<UserInfoData>>
        fun getUserInfo(token: String, userId: Long): Observable<HttpResult<UserInfoData>>
        fun getKcpInformation(token: String, userId: Long): Observable<HttpResult<KcpInfoData>>
        fun getAppConfig(token: String): Observable<HttpResult<AppConfigData>>
        fun requestSipRegister(data: SipRequest)
        fun getVerifyCode(
            area: String,
            phoneNum: String,
            userCategory: Int
        ): Observable<HttpResult<ResponseTopData>>

        fun loginWithMsgCode(bean: LoginMsgCodeBean): Observable<HttpResult<LoginResponseData>>
        fun getFcmsInfoList(
            region: String,
            language: String
        ): Observable<HttpResult<MutableList<FcmsInfoData>>>

        fun getAgreement(): Observable<HttpResult<PolicyAgreementData>>
    }

}
